using GTA;
using GTA.Math;
using GTA.Native;

namespace CustomPeds;

public static class OtherHelper
{
    public enum DecalTypes
    {
        splatters_blood = 1010,
        splatters_blood_dir = 1015,
        splatters_blood_mist = 1017,
        splatters_mud = 1020,
        splatters_paint = 1030,
        splatters_water = 1040,
        splatters_water_hydrant = 1050,
        splatters_blood2 = 1110,
        weapImpact_metal = 4010,
        weapImpact_concrete = 4020,
        weapImpact_mattress = 4030,
        weapImpact_mud = 4032,
        weapImpact_wood = 4050,
        weapImpact_sand = 4053,
        weapImpact_cardboard = 4040,
        weapImpact_melee_glass = 4100,
        weapImpact_glass_blood = 4102,
        weapImpact_glass_blood2 = 4104,
        weapImpact_shotgun_paper = 4200,
        weapImpact_shotgun_mattress = 4201,
        weapImpact_shotgun_metal = 4202,
        weapImpact_shotgun_wood = 4203,
        weapImpact_shotgun_dirt = 4204,
        weapImpact_shotgun_tvscreen = 4205,
        weapImpact_shotgun_tvscreen2 = 4206,
        weapImpact_shotgun_tvscreen3 = 4207,
        weapImpact_melee_concrete = 4310,
        weapImpact_melee_wood = 4312,
        weapImpact_melee_metal = 4314,
        burn1 = 4421,
        burn2 = 4422,
        burn3 = 4423,
        burn4 = 4424,
        burn5 = 4425,
        bang_concrete_bang = 5000,
        bang_concrete_bang2 = 5001,
        bang_bullet_bang = 5002,
        bang_bullet_bang2 = 5004,
        bang_glass = 5031,
        bang_glass2 = 5032,
        solidPool_water = 9000,
        solidPool_blood = 9001,
        solidPool_oil = 9002,
        solidPool_petrol = 9003,
        solidPool_mud = 9004,
        porousPool_water = 9005,
        porousPool_blood = 9006,
        porousPool_oil = 9007,
        porousPool_petrol = 9008,
        porousPool_mud = 9009,
        porousPool_water_ped_drip = 9010,
        liquidTrail_water = 9050
    }

    public static int GetFollowPedCamViewMode()
    {
        return Function.Call<int>((Hash)0x8D4D46230B2C353Aul);
    }

    public static bool IsPlayerSwitchProgress()
    {
        return Function.Call<bool>((Hash)0xD9D2CFFF49FAB35Ful);
    }

    public static void SetFollowPedCamViewMode(int viewMode)
    {
        Function.Call<int>((Hash)0x5A4F9EDF1673F704ul, viewMode);
    }

    public static void DisplayHelpTextThisFrame(string text, bool loop = false)
    {
        Function.Call((Hash)0x8509B634FBE7DA11ul, "STRING");
        Function.Call((Hash)0x6C188BE134E074AAul, text);
        Function.Call((Hash)0x238FFE5C7B0498A6ul, 0, loop, 1, -1);
    }

    public static void PlayNonLoopEffxAtCoord(string effxLibrary, string effxName, Vector3 loc, Vector3 rot, float size, float R, float G, float B)
    {
        if (!Function.Call<bool>((Hash)0x8702416E512EC454ul, effxLibrary))
        {
            Function.Call((Hash)0xB80D8756B4668AB6ul, effxLibrary);
        }
        Function.Call((Hash)0x6C38AF3693A69A91ul, effxLibrary);
        Function.Call((Hash)0x26143A59EF48B262ul, R, G, B);
        Function.Call<int>((Hash)0x25129531F77B9ED3ul, effxName, loc.X, loc.Y, loc.Z, rot.X, rot.Y, rot.Z, size, false, false, false, false);
    }

    public static void PlayNonloopEffxOnEntity(Entity entity, string effxLibrary, string effxName, Vector3 Offset, Vector3 RotOffset, float size, float R, float G, float B)
    {
        if (!Function.Call<bool>((Hash)0x8702416E512EC454ul, effxLibrary))
        {
            Function.Call((Hash)0xB80D8756B4668AB6ul, effxLibrary);
        }
        Function.Call((Hash)0x6C38AF3693A69A91ul, effxLibrary);
        Function.Call<int>((Hash)0x0D53A3B8DA0809D2ul, effxName, entity, Offset.X, Offset.Y, Offset.Z, RotOffset.X, RotOffset.Y, RotOffset.Z, size, false, false, false);
        Function.Call((Hash)0x26143A59EF48B262ul, R, G, B);
    }

    public static void PlayNonloopEffxOnBone(Ped entityPed, string effxLibrary, string effxName, Vector3 Offset, Vector3 RotOffset, Bone BoneId, float size, float R, float G, float B)
    {
        if (!Function.Call<bool>((Hash)0x8702416E512EC454ul, effxLibrary))
        {
            Function.Call((Hash)0xB80D8756B4668AB6ul, effxLibrary);
        }
        Function.Call((Hash)0x6C38AF3693A69A91ul, effxLibrary);
        Function.Call<int>((Hash)0x0E7E72961BA18619ul, effxName, entityPed, Offset.X, Offset.Y, Offset.Z, RotOffset.X, RotOffset.Y, RotOffset.Z, (int)BoneId, size, false, false, false);
        Function.Call((Hash)0x26143A59EF48B262ul, R, G, B);
    }

    public static void AddDecal(Vector3 pos, DecalTypes decalType, float width = 1f, float height = 1f, float rCoef = 0.1f, float gCoef = 0.1f, float bCoef = 0.1f, float opacity = 1f, float timeout = 20f)
    {
        Function.Call<int>((Hash)0xB302244A1839BDADul, (int)decalType, pos.X, pos.Y, pos.Z, 0, 0, -1.0, 0, 1.0, 0, width, height, rCoef, gCoef, bCoef, opacity, timeout, 0, 0, 0);
    }
}


